package com.itheima.service.impl;
import com.itheima.dao.AccountDao;
import com.itheima.domain.Account;
import com.itheima.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;



@Service
public class AccountServiceImpl  implements AccountService{
 @Autowired
    private AccountDao accountDao;
    @Autowired
    private TranTest tranTest;
    public Account findByid(Integer id) {
        Account byid = accountDao.findByid(id);
        return byid;
    }

    public void add(Account account) {
        accountDao.add(account);
    }

    public void delete(Account account) {
        accountDao.delete(account);
    }

    public void update(Account account) {
        accountDao.update(account);
    }

    public void tran(Account a, Account b) {

        try {
            accountDao.add(a);
            int i=1/0;
            accountDao.add(b);

        } finally {
            tranTest.peint();
        }
    }
}
